package com.kly.user.enums;

public enum RememberTime {

    One_MINUTES(1,60L,"一分钟"),

    FIVE_MINUTES(2,60*5L,"五分钟"),

    TNE_MINUTES(3,60*10L,"十分钟"),

    ONE_HOURS(4,60*60L,"一小时"),

    ONE_DAY(5,60*60*24L,"一天"),

    ONE_WEEK(6,60*60*24*7L,"一周"),

    ONE_MONTH(7,60*60*24*30L,"一个月"),

    ONE_YEAR(8,60*60*24*360L,"一年"),

    THREE_DAY(9,60*60*24L*3,"三天"),

    THREE_MINUTES(10,60*3L,"三分钟"),

    TWO_MINUTES(11,60*2L,"2分钟"),

    ;

    private final int code;
    private final long time;
    private final String comment;

    RememberTime(int code, Long time, String comment) {
        this.code = code;
        this.time=time;
        this.comment=comment;
    }

    public static RememberTime getByCode(int code) {
        for (RememberTime rt : values()) {
            if (rt.code == code) {
                return rt;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }

    public int getCode() {
        return code;
    }

    public long getTime() {
        return time;
    }

    public String getComment() {
        return comment;
    }
}
